home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / smashing.swf / scripts / DefineSprite_30_mcBullet / frame_2 / DoAction.as
Encoding:
Text File  |  2008-03-12  |  1.3 KB  |  41 lines

  1. if(!_parent.gamePaused)
  2. {
  3.    if(this._y < _parent.topWall)
  4.    {
  5.       _parent.bulletsFired--;
  6.       mcPath = eval(_target);
  7.       mcPath.removeMovieClip();
  8.       stop();
  9.    }
  10.    else
  11.    {
  12.       TargetY = _Y - 20;
  13.       TargetX = _X;
  14.       iterations = _parent.iterations;
  15.       pixelsMoveY = (TargetY - _Y) / iterations;
  16.       b = 1;
  17.       while(iterations >= b)
  18.       {
  19.          testMoveY = _Y + pixelsMoveY * b;
  20.          if(_parent.bricks.hitTest(_X,testMoveY,true))
  21.          {
  22.             _parent.bulletsFired--;
  23.             _root.clipCounter = _root.clipCounter + 1;
  24.             _root.attachMovie("mcExplosion","mcExplosion" + _root.clipCounter,_root.clipCounter);
  25.             _root["mcExplosion" + _root.clipCounter]._x = TargetX;
  26.             _root["mcExplosion" + _root.clipCounter]._y = testMoveY;
  27.             _root["mcExplosion" + _root.clipCounter]._xscale = _parent.bulletSize / 4;
  28.             _root["mcExplosion" + _root.clipCounter]._yscale = _parent.bulletSize / 4;
  29.             _root["mcExplosion" + _root.clipCounter]._rotation = random(360);
  30.             mcPath = eval(_target);
  31.             mcPath.removeMovieClip();
  32.             stop();
  33.             break;
  34.          }
  35.          b++;
  36.       }
  37.       _Y = TargetY;
  38.       gotoAndPlay(_currentframe - 1);
  39.    }
  40. }
  41.